Skip to content

🤖 fix: a parent's waiting message no longer unarchives a child the user archived - #7721

Merged
ThomasK33 merged 4 commits into
mainfrom
tests/f203-resend-archived-child
Oct 29, 2026
Merged

ThomasK33 merged 4 commits into
mainfrom
tests/f203-resend-archived-child

Conversation

@ThomasK33

@ThomasK33 ThomasK33 commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

Summary

A child task that the user archived no longer comes back unarchived when a parent's waiting message is delivered. If the user archives the child while the message waits for its stream to end, the archive wins, as a Stop already does. Fixes #7720.

Background

#7618 (F54) made a trusted message to a reported or interrupted child that is still streaming without an execution return queued. Xum redelivers the message once the child is idle. The redelivery runs the normal dispatch. That dispatch treats an archived child as inactive and calls reactivateInactiveAgentTask, which unarchives the child and its ancestors before its Stop check. So an archive made during the wait was undone.

A direct send to a child that is already archived still unarchives it. That is intended: the sender chose to bring back the child after the archive.

Implementation

  • The deferral record and each redelivery attempt carry archivedAtSend: the target's archivedAt at the original send, or null when it was not archived.
  • deferDescendantMessage now returns a result or null. When a redelivery finds the target archived with a different archivedAt than at the send, it returns not_active ("archived while the message waited"). It does not reawaken the child. This covers an unarchive and re-archive during the wait too (Codex review). The pure helper resolveDeferralArchivedAtSend makes the decision, so dispatchTrustedDescendantMessage does not grow.
  • archivedAtSend lives only in the in-memory deferral record (DeferredDescendantMessage and DeferredDescendantRedelivery). This PR adds no persisted field and no config or history write.

Known limit

The parent already got queued for this message. When the archive wins, the scheduler only logs the dropped message ("Deferred descendant message was not delivered"). A Stop during the wait drops its message the same way today.

Two narrower cases stay open, tracked in #7730:

  1. The child was already archived at the send, and the user archives an unarchived ancestor during the wait. The redelivery still unarchives the chain, including that ancestor. This comes from the F54 wait.
  2. An archive that lands while the send itself waits for the mutex or for prepareReawakenAi counts as present at send. That race already exists on main for every direct send.

#7730 proposes an archive fence for the task and its ancestors, captured before the first await.

Validation

New parametrized test in taskService.reawakening.test.ts, "a deferred parent message ...". Each case sends while the reported child streams, applies the user's change during the wait, ends the stream and flushes the drains.

Case main first commit this PR
archived during the wait: stays archived fail pass pass
unarchived and archived again during the wait: stays archived fail fail pass
archived at the send, untouched: unarchived (intended) pass pass pass

Note

The F54 redelivery runs outside agentPeerMessageBroker.withDeliveryLock. This is not a defect. Parent sends never take that lock, and sibling sends did their rate, duplicate and queue-cap accounting under the lock at the original send. So only their order against a concurrent task_send_message to the same target changes, and that send already arrives first because the deferral returns at once.


Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high • Cost: $296.45

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-29T16:45:00.079829Z cae39ff New commits
🔒 Security Review ✅ Completed 2026-10-29T16:58:59.917498Z cae39ff Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cc46470363

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/node/services/taskService.ts Resolved
@github-actions

github-actions Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

🟢 e2e stories (Haiku): 14 passed

22 agent steps · 7 replayed from cache · 15 model calls · 46.3k tokens (27% cached)
Spend: $0.09 of the $1.00 cap (proxy ledger)

All 14 tests in 9 files
Test Agent Time
🟢 chatRestart.e2e.ts · 1 passed 1 step · 1 call 5.6s
🟢 a chat survives a restart of the server 1 step · 1 call 5.6s
🟢 compaction.e2e.ts · 1 passed 1 step · 1 call 4.0s
🟢 /compact replaces the old chat with a summary 1 step · 1 call 4.0s
🟢 pluginTrustRestart.e2e.ts · 1 passed 4 steps · 2 calls 9.1s
🟢 a trusted plugin hook stays trusted after the server restarts 4 steps · 2 calls 9.1s
🟢 settingsRoundTrip.e2e.ts · 1 passed 2 steps · 1 call 8.9s
🟢 a chat survives trips through Settings 2 steps · 1 call 8.9s
🟢 sidebarPerWorkspace.e2e.ts · 1 passed 4 steps · 1 call 4.5s
🟢 a new workspace starts with its right sidebar collapsed while another keeps it open 4 steps · 1 call 4.5s
🟢 smoke.e2e.ts · 1 passed 2 steps · 1 call 4.5s
🟢 the agent opens the playground workspace 2 steps · 1 call 4.5s
🟢 streamErrors.e2e.ts · 1 passed 1 step · 1 call 6.6s
🟢 stream errors show in the chat, and the chat recovers 1 step · 1 call 6.6s
🟢 todoNudge.e2e.ts · 1 passed 1 step · 1 call 3.0s
🟢 the agent finishes open TODO items after the turn-end nudge 1 step · 1 call 3.0s
🟢 touchAlignment.e2e.ts · 6 passed 6 steps · 6 calls 22.7s
🟢 the Settings close button is level with the title on a touch screen 390px wide 1 step · 1 call 3.7s
🟢 the Settings close button is level with the title on a touch screen 768px wide 1 step · 1 call 4.1s
🟢 Backup settings checkboxes are small and level with their labels on a touch phone 1 step · 1 call 4.5s
🟢 the heartbeat checkbox is small and level with its label on a touch phone 1 step · 1 call 3.8s
🟢 a reply's model and time stay on one line on a touch phone 1 step · 1 call 3.7s
🟢 the workspace actions menu stays on the title row on a touch phone 1 step · 1 call 2.8s

e2e 0.20.0 · 1m 12s · web · run artifacts

🟢 e2e Electron stories (Haiku): 3 passed

3 agent steps · 3 model calls · 8.0k tokens (32% cached)
Spend: $0.01 of the $1.00 cap (proxy ledger)

All 3 tests in 3 files
Test Agent Time
🟢 electron/deepLink.e2e.ts · 1 passed 1 step · 1 call 5.5s
🟢 a deep link of a second launch starts a chat in the running app 1 step · 1 call 5.5s
🟢 electron/menuBar.e2e.ts · 1 passed 1 step · 1 call 6.4s
🟢 the workspace menu bar is the desktop title bar 1 step · 1 call 6.4s
🟢 electron/smoke.e2e.ts · 1 passed 1 step · 1 call 5.1s
🟢 Xum Electron opens the playground workspace 1 step · 1 call 5.1s

e2e 0.20.0 · 19.0s · electron · run artifacts

🟢 e2e agent repros (Haiku): no tests selected

Spend: $0.00 of the $1.00 cap (proxy ledger)

e2e 0.20.0 · 5.4s · 2 targets (web, phone) · run artifacts

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex security review

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review

Security review completed. No security issues were found in this pull request.

Reviewed commit: 18b1cfc8ef

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@ThomasK33

Copy link
Copy Markdown
Member Author

Readiness record (head 18b1cfc8ef):

@chatgpt-codex-connector

This comment has been minimized.

@ThomasK33

Copy link
Copy Markdown
Member Author

Readiness record, update (head cae39ff73b, a merge of main at 616277e into 18b1cfc8ef, with no code change):

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cae39ff73b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/node/services/taskService.ts Resolved
Comment thread src/node/services/taskService.ts Resolved
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex security review

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review

Security review completed. No security issues were found in this pull request.

Reviewed commit: cae39ff73b

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@ThomasK33
ThomasK33 added this pull request to the merge queue Oct 29, 2026
Merged via the queue into main with commit 8b2657c Oct 29, 2026
65 of 67 checks passed
@ThomasK33
ThomasK33 deleted the tests/f203-resend-archived-child branch October 29, 2026 17:22
yermakoffivan pushed a commit to yermakoffivan/mux that referenced this pull request Oct 29, 2026
…receipt for the head (coder#7729)

## Summary

The `Codex Comments` gate (and so `Required`) no longer fails on a PR
where Codex's security review found nothing but finished with null
findings flags. The gate accepts that one state only beside a clean
security receipt for the current head, with no open Codex thread. Every
other unknown state still blocks.

Fixes coder#7727.

## Background

Since about 2026-10-28, Codex's summary board can record a finished
security review as `{"has_any_findings": null,
"has_unresolved_findings": null, "status": "completed"}`.
`codex_summary_status` accepted null flags only while a review runs, so
it returned unknown, and the board counted as an unresolved Codex
comment. Rerunning the job could not help. Open PRs coder#7722, coder#7724, coder#7723,
coder#7721 and coder#7717 all had this state on their latest board. coder#7722 is the
observed fixture.

## Implementation

`codex_summary_status` accepts a completed `security_review` with both
flags null only when ALL of these hold:

1. The review state's `commit_sha` is the PR's current head.
2. The board's security metadata line says `status: completed` for the
current head, with `mergeGateEnabled: false`.
3. The board has no `### Security findings` or advisory section.
4. An unminimized Codex comment is the clean security receipt ("Security
review completed. No security issues were found in this pull request.")
and names a reviewed commit that matches the current head. A receipt
without a commit line does not count here.
5. No Codex review thread is unresolved.

`check_codex_comments.sh` computes 4 and 5 and passes them as
`.clean_security_receipt`. A caller that does not set it gets the old
fail-closed behavior. The receipt regex moved into one shared
`codex_clean_security_receipt` def, so the informational check and this
check use the same text.

## Why the gate stays safe

- Null flags still block in every other case: a code review, an older
head, no receipt, a receipt for another commit, a minimized receipt, an
advisory section, the merge gate on, or an open Codex thread.
- The receipt is Codex's own verdict for that exact commit. It carries
no finding by construction: the regex is anchored and accepts only fixed
text.
- Findings never depend on the flags alone. Code and security findings
are review threads, and the gate counts open Codex threads separately.
Advisory findings are board bullets, and they block as before.
- A running review with null flags is unchanged: it still exits 10 (in
progress).

## Validation

- New test
`test_null_security_flags_pass_only_with_a_clean_receipt_for_this_head`,
run against the real shell entrypoint with the observed coder#7722 board and
receipt as fixtures (with and without the cached payload). Cases: clean
receipt for this head passes (0); no receipt (1); an open Codex thread
(1); a receipt for an older head (1); board and receipt for an older
head (1); an advisory section (1); the merge gate on (1); running with
null flags (10); a minimized receipt (1).
- On main, only the "clean receipt for this head" case fails (1 instead
of 0). Every blocking case blocks before and after.
- `make test-codex-comments` passes in full.
- A live run of `./scripts/check_codex_comments.sh 7722` with this
change: "No unresolved Codex comments found".

---

_Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking:
`high` • Cost: `$248.33`_

<!-- mux-attribution: model=anthropic:claude-opus-5-5 thinking=high
costs=248.33 -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🤖 fix: a parent's waiting message unarchives a child the user archived

1 participant